/*
 * Pratama Nur Wijaya (c) 2013 
 * 
 * Project       : Sound Of Indonesia
 * Filename      : SceneManager.java
 * Creation Date : Mar 30, 2013 time : 9:32:16 PM
 *
 */

package id.pratama.soundofindonesia;

import id.pratama.soundofindonesia.scene.Scene_Credit;
import id.pratama.soundofindonesia.scene.Scene_Info_Alat_Musik;
import id.pratama.soundofindonesia.scene.Scene_Menu_Pilih_Alat_Musik;
import id.pratama.soundofindonesia.scene.Scene_Menu_Utama;
import id.pratama.soundofindonesia.scene.Scene_Play_Alat_Musik;
import id.pratama.soundofindonesia.scene.Scene_Splash;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.scene.Scene;
import org.andengine.ui.activity.BaseGameActivity;

public class SceneManager
{
	public static final int				SCENE_SPLASH				= 0;
	public static final int				SCENE_MENU_UTAMA			= 1;
	public static final int				SCENE_MENU_PILIH_ALAT_MUSIK	= 2;
	public static final int				SCENE_MENU_PLAY_ALAT_MUSIK	= 3;
	public static final int				SCENE_INFO_ALAT_MUSIK		= 4;
	public static final int				SCENE_MENU_CREDIT			= 5;
	public static int					currentScene				= SCENE_SPLASH;

	public static final int				TYPE_ANGKLUNG				= 0;
	public static final int				TYPE_GAMELAN				= 1;

	private static final SceneManager	INSTANCE					= new SceneManager();

	private BaseGameActivity			activity;
	public static Scene					loadedScene;

	public static void prepareSceneManager(BaseGameActivity activity, Camera camera)
	{
		getInstance().activity = activity;
	}

	public static SceneManager getInstance()
	{
		return INSTANCE;
	}

	public void setScene(int scene)
	{
		currentScene = scene;
		switch (scene)
		{
			case SCENE_SPLASH:
				loadedScene = new Scene_Splash(activity);
				break;
			case SCENE_MENU_UTAMA:
				loadedScene = new Scene_Menu_Utama(activity);
				break;
			case SCENE_MENU_PILIH_ALAT_MUSIK:
				loadedScene = new Scene_Menu_Pilih_Alat_Musik(activity);
				break;
			case SCENE_MENU_CREDIT:
				loadedScene = new Scene_Credit(activity);
				break;
		}
		/*
		 * Set engine agar menggunakan scene yang dipilih
		 */
		activity.getEngine().setScene(loadedScene);
	}

	// set scene khusus pilih alat musik
	public void setScene(int scene, int type)
	{
		currentScene = scene;
		switch (scene)
		{
			case SCENE_MENU_PLAY_ALAT_MUSIK:
				loadedScene = new Scene_Play_Alat_Musik(activity, type);
				break;
			case SCENE_INFO_ALAT_MUSIK:
				loadedScene = new Scene_Info_Alat_Musik(activity, type);
				break;
		}
		/*
		 * Set engine agar menggunakan scene yang dipilih
		 */
		activity.getEngine().setScene(loadedScene);
	}

}
